package com.jfirer.validator.constraint;

import javax.validation.ConstraintViolation;
import javax.validation.Path;
import javax.validation.metadata.ConstraintDescriptor;
import com.jfirer.validator.WritableConstraintViolation;

public class WritableConstraintViolationImpl<T> implements ConstraintViolation<T>, WritableConstraintViolation<T>
{
    private String                  message;
    private String                  messageTemplate;
    private T                       rootBean;
    private Class<T>                rootBeanClass;
    private Object                  leafBean;
    private Path                    propertyPath;
    private Object                  invalidValue;
    private ConstraintDescriptor<?> constraintDescriptor;
    private Object[]                executableParameters;
    private Object                  executableReturnValue;
    
    @Override
    public String getMessage()
    {
        return message;
    }
    
    @Override
    public String getMessageTemplate()
    {
        return messageTemplate;
    }
    
    @Override
    public T getRootBean()
    {
        return rootBean;
    }
    
    @Override
    public Class<T> getRootBeanClass()
    {
        return rootBeanClass;
    }
    
    @Override
    public Object getLeafBean()
    {
        return leafBean;
    }
    
    @Override
    public Path getPropertyPath()
    {
        return propertyPath;
    }
    
    @Override
    public Object getInvalidValue()
    {
        return invalidValue;
    }
    
    @Override
    public ConstraintDescriptor<?> getConstraintDescriptor()
    {
        return constraintDescriptor;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see
     * com.jfireframework.validator.impl.WritableConstraintViolation#setMessage(
     * java.lang.String)
     */
    @Override
    public void setMessage(String message)
    {
        this.message = message;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setMessageTemplate(java.lang.String)
     */
    @Override
    public void setMessageTemplate(String messageTemplate)
    {
        this.messageTemplate = messageTemplate;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see
     * com.jfireframework.validator.impl.WritableConstraintViolation#setRootBean
     * (T)
     */
    @Override
    public void setRootBean(T rootBean)
    {
        this.rootBean = rootBean;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setRootBeanClass(java.lang.Class)
     */
    @Override
    public void setRootBeanClass(Class<T> rootBeanClass)
    {
        this.rootBeanClass = rootBeanClass;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see
     * com.jfireframework.validator.impl.WritableConstraintViolation#setLeafBean
     * (java.lang.Object)
     */
    @Override
    public void setLeafBean(Object leafBean)
    {
        this.leafBean = leafBean;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setPropertyPath(javax.validation.Path)
     */
    @Override
    public void setPropertyPath(Path propertyPath)
    {
        this.propertyPath = propertyPath;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setInvalidValue(java.lang.Object)
     */
    @Override
    public void setInvalidValue(Object invalidValue)
    {
        this.invalidValue = invalidValue;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setConstraintDescriptor(javax.validation.metadata.ConstraintDescriptor)
     */
    @Override
    public void setConstraintDescriptor(ConstraintDescriptor<?> constraintDescriptor)
    {
        this.constraintDescriptor = constraintDescriptor;
    }
    
    @Override
    public Object[] getExecutableParameters()
    {
        return executableParameters;
    }
    
    @Override
    public Object getExecutableReturnValue()
    {
        return executableReturnValue;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setExecutableParameters(java.lang.Object[])
     */
    @Override
    public void setExecutableParameters(Object[] executableParameters)
    {
        this.executableParameters = executableParameters;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.jfireframework.validator.impl.WritableConstraintViolation#
     * setExecutableReturnValue(java.lang.Object)
     */
    @Override
    public void setExecutableReturnValue(Object executableReturnValue)
    {
        this.executableReturnValue = executableReturnValue;
    }
    
    @Override
    public <U> U unwrap(Class<U> type)
    {
        throw new UnsupportedOperationException();
    }
    
}
